home *** CD-ROM | disk | FTP | other *** search
- unit Exthan0;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, AdTerm, AdPort;
-
- type
- TMyListBox = class(TListBox)
- procedure TriggerAvail(var Message : TMessage); message APW_TRIGGERAVAIL;
- end;
-
- TForm1 = class(TForm)
- ApdComPort1: TApdComPort;
- ApdTerminal1: TApdTerminal;
- Register: TButton;
- procedure RegisterClick(Sender: TObject);
- private
- ListBox1 : TMyListBox;
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
- GlobalPort : TApdComPort;
-
- implementation
-
- {$R *.DFM}
-
- procedure TMyListBox.TriggerAvail(var Message : TMessage);
- var
- I : Word;
- S : String;
- begin
- S := '';
- for I := 1 to Message.wParam do
- S := S + GlobalPort.GetChar;
- Items.Add(S);
- end;
-
- procedure TForm1.RegisterClick(Sender: TObject);
- begin
- GlobalPort := ApdComPort1;
- ListBox1 := TMyListBox.Create(Self);
- ListBox1.Name := 'ListBox1';
- ListBox1.Parent := Self;
- ListBox1.Show;
- ApdComPort1.RegisterTriggerHandler(ListBox1.Handle, nil);
- end;
-
- end.
-